home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / PInterfaces / QuickdrawText.p < prev    next >
Encoding:
Text File  |  1994-07-17  |  7.6 KB  |  236 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QuickdrawText.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT QuickdrawText;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __QUICKDRAWTEXT__}
  27. {$SETC __QUICKDRAWTEXT__ := 1}
  28.  
  29. {$I+}
  30. {$SETC QuickdrawTextIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.  
  43. CONST
  44. { CharToPixel directions }
  45.     leftCaret                    = 0;                            {Place caret for left block}
  46.     rightCaret                    = -1;                            {Place caret for right block}
  47.     hilite                        = 1;                            {Direction is SysDirection}
  48.     smLeftCaret                    = 0;                            {Place caret for left block - obsolete }
  49.     smRightCaret                = -1;                            {Place caret for right block - obsolete }
  50.     smHilite                    = 1;                            {Direction is TESysJust - obsolete }
  51. {Constants for styleRunPosition argument in PortionLine, DrawJustified,
  52.  MeasureJustified, CharToPixel, and PixelToChar.}
  53.     onlyStyleRun                = 0;                            { This is the only style run on the line }
  54.     leftStyleRun                = 1;                            { This is leftmost of multiple style runs on the line }
  55.     rightStyleRun                = 2;                            { This is rightmost of multiple style runs on the line }
  56.     middleStyleRun                = 3;                            { There are multiple style runs on the line and this 
  57.  is neither the leftmost nor the rightmost. }
  58.     smOnlyStyleRun                = 0;                            { obsolete }
  59.     smLeftStyleRun                = 1;                            { obsolete }
  60.     smRightStyleRun                = 2;                            { obsolete }
  61.     smMiddleStyleRun            = 3;                            { obsolete }
  62.  
  63. { type for styleRunPosition parameter in PixelToChar etc. }
  64.     
  65. TYPE
  66. JustStyleCode = INTEGER;
  67.  
  68.     FontInfo = RECORD
  69.         ascent:                    INTEGER;
  70.         descent:                INTEGER;
  71.         widMax:                    INTEGER;
  72.         leading:                INTEGER;
  73.     END;
  74.     FormatOrder = ARRAY [0..0] OF INTEGER;
  75.  
  76.     FormatOrderPtr = ^FormatOrder;
  77.  
  78.     FormatStatus = INTEGER;
  79.  
  80.     OffPair = RECORD
  81.         offFirst:                INTEGER;
  82.         offSecond:                INTEGER;
  83.     END;
  84.     OffsetTable = ARRAY [0..2] OF OffPair;
  85.  
  86.  
  87. FUNCTION Pixel2Char(textBuf: Ptr; textLen: INTEGER; slop: INTEGER; pixelWidth: INTEGER; VAR leadingEdge: BOOLEAN): INTEGER;
  88.     {$IFC NOT GENERATINGCFM}
  89.     INLINE $2F3C, $820E, $0014, $A8B5;
  90.     {$ENDC}
  91. FUNCTION Char2Pixel(textBuf: Ptr; textLen: INTEGER; slop: INTEGER; offset: INTEGER; direction: INTEGER): INTEGER;
  92.     {$IFC NOT GENERATINGCFM}
  93.     INLINE $2F3C, $820C, $0016, $A8B5;
  94.     {$ENDC}
  95. FUNCTION PixelToChar(textBuf: Ptr; textLength: LONGINT; slop: Fixed; pixelWidth: Fixed; VAR leadingEdge: BOOLEAN; VAR widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  96.     {$IFC NOT GENERATINGCFM}
  97.     INLINE $2F3C, $8222, $002E, $A8B5;
  98.     {$ENDC}
  99. FUNCTION CharToPixel(textBuf: Ptr; textLength: LONGINT; slop: Fixed; offset: LONGINT; direction: INTEGER; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  100.     {$IFC NOT GENERATINGCFM}
  101.     INLINE $2F3C, $821C, $0030, $A8B5;
  102.     {$ENDC}
  103. PROCEDURE DrawJustified(textPtr: Ptr; textLength: LONGINT; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  104.     {$IFC NOT GENERATINGCFM}
  105.     INLINE $2F3C, $8016, $0032, $A8B5;
  106.     {$ENDC}
  107. PROCEDURE MeasureJustified(textPtr: Ptr; textLength: LONGINT; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  108.     {$IFC NOT GENERATINGCFM}
  109.     INLINE $2F3C, $801A, $0034, $A8B5;
  110.     {$ENDC}
  111. FUNCTION PortionLine(textPtr: Ptr; textLen: LONGINT; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed;
  112.     {$IFC NOT GENERATINGCFM}
  113.     INLINE $2F3C, $8412, $0036, $A8B5;
  114.     {$ENDC}
  115. PROCEDURE HiliteText(textPtr: Ptr; textLength: INTEGER; firstOffset: INTEGER; secondOffset: INTEGER; VAR offsets: OffsetTable);
  116.     {$IFC NOT GENERATINGCFM}
  117.     INLINE $2F3C, $800E, $001C, $A8B5;
  118.     {$ENDC}
  119. PROCEDURE DrawJust(textPtr: Ptr; textLength: INTEGER; slop: INTEGER);
  120.     {$IFC NOT GENERATINGCFM}
  121.     INLINE $2F3C, $8008, $001E, $A8B5;
  122.     {$ENDC}
  123. PROCEDURE MeasureJust(textPtr: Ptr; textLength: INTEGER; slop: INTEGER; charLocs: Ptr);
  124.     {$IFC NOT GENERATINGCFM}
  125.     INLINE $2F3C, $800C, $0020, $A8B5;
  126.     {$ENDC}
  127. FUNCTION PortionText(textPtr: Ptr; textLength: LONGINT): Fixed;
  128.     {$IFC NOT GENERATINGCFM}
  129.     INLINE $2F3C, $8408, $0024, $A8B5;
  130.     {$ENDC}
  131. FUNCTION VisibleLength(textPtr: Ptr; textLength: LONGINT): LONGINT;
  132.     {$IFC NOT GENERATINGCFM}
  133.     INLINE $2F3C, $8408, $0028, $A8B5;
  134.     {$ENDC}
  135. PROCEDURE GetFormatOrder(ordering: FormatOrderPtr; firstFormat: INTEGER; lastFormat: INTEGER; lineRight: BOOLEAN; rlDirProc: Ptr; dirParam: Ptr);
  136.     {$IFC NOT GENERATINGCFM}
  137.     INLINE $2F3C, $8012, $FFFC, $A8B5;
  138.     {$ENDC}
  139. PROCEDURE TextFont(font: INTEGER);
  140.     {$IFC NOT GENERATINGCFM}
  141.     INLINE $A887;
  142.     {$ENDC}
  143. PROCEDURE TextFace(face: INTEGER);
  144.     {$IFC NOT GENERATINGCFM}
  145.     INLINE $A888;
  146.     {$ENDC}
  147. PROCEDURE TextMode(mode: INTEGER);
  148.     {$IFC NOT GENERATINGCFM}
  149.     INLINE $A889;
  150.     {$ENDC}
  151. PROCEDURE TextSize(size: INTEGER);
  152.     {$IFC NOT GENERATINGCFM}
  153.     INLINE $A88A;
  154.     {$ENDC}
  155. PROCEDURE SpaceExtra(extra: Fixed);
  156.     {$IFC NOT GENERATINGCFM}
  157.     INLINE $A88E;
  158.     {$ENDC}
  159. PROCEDURE DrawChar(ch: CHAR);
  160.     {$IFC NOT GENERATINGCFM}
  161.     INLINE $A883;
  162.     {$ENDC}
  163. PROCEDURE DrawString(s: ConstStr255Param);
  164.     {$IFC NOT GENERATINGCFM}
  165.     INLINE $A884;
  166.     {$ENDC}
  167. PROCEDURE DrawText(textBuf: UNIV Ptr; firstByte: INTEGER; byteCount: INTEGER);
  168.     {$IFC NOT GENERATINGCFM}
  169.     INLINE $A885;
  170.     {$ENDC}
  171. FUNCTION CharWidth(ch: CHAR): INTEGER;
  172.     {$IFC NOT GENERATINGCFM}
  173.     INLINE $A88D;
  174.     {$ENDC}
  175. FUNCTION StringWidth(s: ConstStr255Param): INTEGER;
  176.     {$IFC NOT GENERATINGCFM}
  177.     INLINE $A88C;
  178.     {$ENDC}
  179. FUNCTION TextWidth(textBuf: UNIV Ptr; firstByte: INTEGER; byteCount: INTEGER): INTEGER;
  180.     {$IFC NOT GENERATINGCFM}
  181.     INLINE $A886;
  182.     {$ENDC}
  183. PROCEDURE MeasureText(count: INTEGER; textAddr: UNIV Ptr; charLocs: UNIV Ptr);
  184.     {$IFC NOT GENERATINGCFM}
  185.     INLINE $A837;
  186.     {$ENDC}
  187. PROCEDURE GetFontInfo(VAR info: FontInfo);
  188.     {$IFC NOT GENERATINGCFM}
  189.     INLINE $A88B;
  190.     {$ENDC}
  191. PROCEDURE CharExtra(extra: Fixed);
  192.     {$IFC NOT GENERATINGCFM}
  193.     INLINE $AA23;
  194.     {$ENDC}
  195. PROCEDURE StdText(count: INTEGER; textAddr: UNIV Ptr; numer: Point; denom: Point);
  196.     {$IFC NOT GENERATINGCFM}
  197.     INLINE $A882;
  198.     {$ENDC}
  199. FUNCTION StdTxMeas(byteCount: INTEGER; textAddr: UNIV Ptr; VAR numer: Point; VAR denom: Point; VAR info: FontInfo): INTEGER;
  200.     {$IFC NOT GENERATINGCFM}
  201.     INLINE $A8ED;
  202.     {$ENDC}
  203. {$IFC OLDROUTINENAMES }
  204. FUNCTION NPixel2Char(textBuf: Ptr; textLength: LONGINT; slop: Fixed; pixelWidth: Fixed; VAR leadingEdge: BOOLEAN; VAR widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  205.     {$IFC NOT GENERATINGCFM}
  206.     INLINE $2F3C, $8222, $002E, $A8B5;
  207.     {$ENDC}
  208. FUNCTION NChar2Pixel(textBuf: Ptr; textLength: LONGINT; slop: Fixed; offset: LONGINT; direction: INTEGER; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  209.     {$IFC NOT GENERATINGCFM}
  210.     INLINE $2F3C, $821C, $0030, $A8B5;
  211.     {$ENDC}
  212. PROCEDURE NDrawJust(textPtr: Ptr; textLength: LONGINT; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  213.     {$IFC NOT GENERATINGCFM}
  214.     INLINE $2F3C, $8016, $0032, $A8B5;
  215.     {$ENDC}
  216. PROCEDURE NMeasureJust(textPtr: Ptr; textLength: LONGINT; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  217.     {$IFC NOT GENERATINGCFM}
  218.     INLINE $2F3C, $801A, $0034, $A8B5;
  219.     {$ENDC}
  220. FUNCTION NPortionText(textPtr: Ptr; textLen: LONGINT; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed;
  221.     {$IFC NOT GENERATINGCFM}
  222.     INLINE $2F3C, $8412, $0036, $A8B5;
  223.     {$ENDC}
  224. {$ENDC}
  225.  
  226. {$ALIGN RESET}
  227. {$POP}
  228.  
  229. {$SETC UsingIncludes := QuickdrawTextIncludes}
  230.  
  231. {$ENDC} {__QUICKDRAWTEXT__}
  232.  
  233. {$IFC NOT UsingIncludes}
  234.  END.
  235. {$ENDC}
  236.